package com.frank.wcld.zdajpchjqk.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.frank.common.annotation.Log;
import com.frank.common.enums.BusinessType;
import com.frank.wcld.zdajpchjqk.domain.WcldZdajpchj;
import com.frank.wcld.zdajpchjqk.service.IWcldZdajpchjService;
import com.frank.common.core.controller.BaseController;
import com.frank.common.core.domain.AjaxResult;
import com.frank.common.utils.poi.ExcelUtil;
import com.frank.common.core.page.TableDataInfo;

/**
 * 重点案件评查化解情况Controller
 * 
 * @author frank
 * @date 2025-08-23
 */
@Controller
@RequestMapping("/wcld/zdajpchjqk")
public class WcldZdajpchjController extends BaseController
{
    private String prefix = "wcld/zdajpchjqk";

    @Autowired
    private IWcldZdajpchjService wcldZdajpchjService;

    @RequiresPermissions("wcld:zdajpchjqk:view")
    @GetMapping()
    public String zdajpchjqk()
    {
        return prefix + "/zdajpchjqk";
    }

    /**
     * 查询重点案件评查化解情况列表
     */
    @RequiresPermissions("wcld:zdajpchjqk:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(WcldZdajpchj wcldZdajpchj)
    {
        startPage();
        List<WcldZdajpchj> list = wcldZdajpchjService.selectWcldZdajpchjList(wcldZdajpchj);
        return getDataTable(list);
    }

    /**
     * 导出重点案件评查化解情况列表
     */
    @RequiresPermissions("wcld:zdajpchjqk:export")
    @Log(title = "重点案件评查化解情况", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(WcldZdajpchj wcldZdajpchj)
    {
        List<WcldZdajpchj> list = wcldZdajpchjService.selectWcldZdajpchjList(wcldZdajpchj);
        ExcelUtil<WcldZdajpchj> util = new ExcelUtil<WcldZdajpchj>(WcldZdajpchj.class);
        return util.exportExcel(list, "重点案件评查化解情况数据");
    }

    /**
     * 新增重点案件评查化解情况
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存重点案件评查化解情况
     */
    @RequiresPermissions("wcld:zdajpchjqk:add")
    @Log(title = "重点案件评查化解情况", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(WcldZdajpchj wcldZdajpchj)
    {
        wcldZdajpchj.setCreateBy(getLoginName());
        return toAjax(wcldZdajpchjService.insertWcldZdajpchj(wcldZdajpchj));
    }

    /**
     * 修改重点案件评查化解情况
     */
    @RequiresPermissions("wcld:zdajpchjqk:edit")
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        WcldZdajpchj wcldZdajpchj = wcldZdajpchjService.selectWcldZdajpchjById(id);
        mmap.put("wcldZdajpchj", wcldZdajpchj);
        return prefix + "/edit";
    }

    /**
     * 修改保存重点案件评查化解情况
     */
    @RequiresPermissions("wcld:zdajpchjqk:edit")
    @Log(title = "重点案件评查化解情况", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(WcldZdajpchj wcldZdajpchj)
    {
        wcldZdajpchj.setUpdateBy(getLoginName());
        return toAjax(wcldZdajpchjService.updateWcldZdajpchj(wcldZdajpchj));
    }

    /**
     * 删除重点案件评查化解情况
     */
    @RequiresPermissions("wcld:zdajpchjqk:remove")
    @Log(title = "重点案件评查化解情况", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(wcldZdajpchjService.deleteWcldZdajpchjByIds(ids));
    }
}
